/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.card;

import deatax.GameData;
import deatax.display.Texture;
import java.awt.Image;
import java.util.ArrayList;

/**
 *
 * @author pson
 */
public class Card {
    
    private String name;
    
    private String desc;
    
    private Image image;
    
    private ArrayList<CardEffectInstance> effects;
    
    private String type;
    
    private int freq;

    public Card(String name, String desc, String type, int freq) {
        this.name = name;
        this.desc = desc;
        this.type = type;
        this.freq = freq;
        image = Texture.loadImage("cards/" + name.toLowerCase() + ".png");
        effects = new ArrayList<CardEffectInstance>();
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getFreq() {
        return freq;
    }

    public void setFreq(int freq) {
        this.freq = freq;
    }

    public Image getImage() {
        return image;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void addEffect(CardEffect e, String[] args) {
        this.effects.add(new CardEffectInstance(e, args));
    }
    
    public ArrayList<CardEffectInstance> getEffects() {
        return effects;
    }
    
    public void playCard(GameData data) {
        data.getGui().addMessage(data.getCurrentPlayer(), "Draws '" + name + "' (" + type + "): " + desc);
        for (CardEffectInstance cei : effects) {
            cei.run(data);
        }
    }
    
    
}
